home *** CD-ROM | disk | FTP | other *** search
- Path: news.intersurf.net!usenet
- From: "David C. Branton" <dbranton@intersurf.com>
- Newsgroups: comp.lang.c++
- Subject: strcpy problem
- Date: Sat, 17 Feb 1996 10:21:06 -0800
- Organization: McKinley High School
- Message-ID: <31261C92.3DEE@intersurf.com>
- NNTP-Posting-Host: ts1-29.intersurf.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- strcpy does not seem to work in this case. Can anyone explain why?
-
- Here is the setup:
-
- class league
- { protected:
- ...
- struct franchise
- {...
- struct person
- { char name [25];
- ...
- }
- }team [12];
-
- public:
- void draftplayer ();
- ...
- };
-
- void league::draftplayer()
- {
- char playername[25];
- ...
-
- // playername is given a value; tracing confirms that it has a value
-
- strcpy(team[draftpick-1].player[round-1].name, playername);
-
- ...
-
- }
-
- The line strcpy... does not copy the string. When code is traced, there
- is a proper value for playername but nothing gets copied into the nested
- structure. All variable have been properly declared and have values at
- this point.
-
- Any ideas as to why strcpy does not work in this case?
-
- Thanks in advance.
- --
- David Branton dbranton@intersurf.com
- McKinley High School
- Computer Science
-